package com.bwie.auth.controllerfallback;

import com.bwie.auth.feign.AuthFeign;
import com.bwie.common.domain.po.UserPo;
import com.bwie.common.result.Result;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 熔断
 */

@Component
public class AuthFeignFallBack implements FallbackFactory<AuthFeign> {
    @Override
    public AuthFeign create(Throwable cause) {
        return new AuthFeign() {
            @Override
            public Result<UserPo> login(String userName) {
                return Result.error(cause.getMessage());
            }
        };
    }
}
